package com.codermn.test;

import java.util.Random;
import java.util.Scanner;

/**
 * @author jxau_scf
 * @date 2021/5/28 - 19:24
 */
public class GuessNum {
    public static void main(String[] args) {
        Random random = new Random();
        int randomNum = random.nextInt(100) + 1;
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.print("请输入一个数字：");
            int guessNum = scanner.nextInt();
            if (guessNum > randomNum){
                System.out.println("太大了！");
            }else if (guessNum < randomNum){
                System.out.println("太小了！");
            }else {
                System.out.println("恭喜你，猜对了！");
                break;
            }

        }
    }
}
